from typing import *


class Solution:
    def minOperations(self, nums: List[int], k: int) -> int:
        mn = min(nums)
        if k > mn:
            return -1
        
        cnt = Counter(nums)
        return len(cnt.keys()) if k < mn else len(cnt.keys()) - 1 